<%@page import="com.stu.utils.PageBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%-- <jsp:include page="common.jsp"></jsp:include> --%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 

<% 
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>极客之家-用户信息</title>

<meta name="keywords" content="keyword1,keyword2,keyword3">
<meta name="description" content="this is my page">
<meta name="content-type" content="text/html; charset=UTF-8">

<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

</head>

<body>
	<!-- top start -->
	<jsp:include page="top.jsp"></jsp:include>
	<!-- top end -->

	<!-- update information start -->
	<div class="cotainer  infoTable divBlock">
		<table class="table table-striped ">
			<%--table-bordered --%>
			<caption class="text-center">
				<strong>修改个人信息</strong>
			</caption> 
			<thead></thead>
			<tbody>
				<!-- 本系统基本信息 开始 -->
				<input type="hidden" name="uuid" value="${currentUser.uuid }"
					id="uuid">

				<tr> 
					<td colspan="3" class="hidden-lg">账号</td>
				</tr>

				<tr>

					<td class="col-xs-3 col-sm-3 visible-lg">账号</td>
					<td class="col-xs-7 col-sm-7 ">${currentUser.account }</td>
					<td class="col-xs-2 col-sm-2 hidden-xs" rowspan="3"><img id="user_img"
						class="img-responsive img-rounded" src="${currentUser.avatar_url }" title="用户头像" alt="用户头像" height="100px" width="100px;"/> 
						 <form id="user_img_form" target='frameFile' enctype="multipart/form-data" method = "post" action = "user_saveFile.action" style="display:none;">
						 <%-- <s:file  id="user_img_input" name = "uploadImage" onchange="return FileUpload_onselect()"></s:file> --%>
							<input type = "file" id="user_img_input" name = "uploadImage" onchange="return FileUpload_onselect()">
						 </form>
						  
						</td>
						
				</tr>
				
				<tr>
					<td colspan="3" class="hidden-lg">用户主页地址</td>
				</tr>
				
				<tr>
					<td class="col-xs-3 col-sm-3 visible-lg">用户主页地址</td>
					<td class="col-xs-7 col-sm-7 ">${currentUser.url }</td>

				</tr>
				
				<tr>
					<td colspan="3" class="hidden-lg">昵称</td>
				</tr>
				
				<tr>
					<td class="col-xs-3 col-sm-3 visible-lg">昵称</td>
					<td class="col-xs-7 col-sm-7 ">${currentUser.nickname }</td>
					<td></td>
				</tr>
				
				<tr>
					<td colspan="3" class="hidden-lg">电子邮件</td>
				</tr>
				
				<tr>
					<td class="col-xs-3 col-sm-3 visible-lg">电子邮件</td>
					<td class="col-xs-7 col-sm-7 ">${currentUser.email }</td>
					<td class="hidden-xs">
					
						<c:choose>
							<c:when test="${!empty currentUser.email }">
								<a href="#" onclick="reverseBind('<%=basePath%>','email')">解绑</a>
							</c:when> 
							<c:otherwise>
								<a href="<%=basePath %>pages/bindEmail.jsp" >绑定</a>
							</c:otherwise>
						</c:choose>
						
					</td>
				</tr>
				
				<%--
				<tr>
					<td colspan="3" class="hidden-lg">电话</td>
				</tr>
				
				 <tr>
					<td class="col-xs-3 col-sm-3 visible-lg">电话</td>
					<td class="col-xs-7 col-sm-7 ">${currentUser.phone }</td>
					<td><a href="#">绑定</a>|<a href="javascript:void(0);"
						onclick="reverseBind('<%=basePath%>','phone')">解绑</a></td>
				</tr>  --%>
				
				<tr> 
					<td colspan="3" class="hidden-lg">多说id</td>
				</tr>
				
				<tr>
					<td class="col-xs-3 col-sm-3 visible-lg">多说id</td>
					<td class="col-xs-7 col-sm-7 visible-lg">${currentUser.duoshuoid }</td>
					<td class="hidden-xs"></td>
				</tr>
				<!-- 
      <tr >
         <td class="col-xs-3 col-sm-3 visible-lg">用户头像地址</td>
         <td>img_url</td>
         <td><a href="#">修改</a></td> 
      </tr> -->
			</tbody>

		</table>
	</div>
	<!-- update information end -->
	<iframe id='frameFile' name='frameFile' style='display: none;'></iframe>
	
	<%--加载中 start --%> 
		<div id="loading" >上传中...</div>  
		<%--加载中 end --%>
		
		
		
	<jsp:include page="footer.jsp"></jsp:include>

	<!-- js start -->
	<script type="text/javascript" src="<%=path %>/js/user_info.js"></script>
	<script type="text/javascript"> 
		$(function() {
			$("#loading").hide();
			var path='<%=path%>';
			
			$("input[type=file]").hide();
			 
			$("#user_img").click(function(){
				reset();
				 alertify.confirm("确定修改头像吗？", function (e) { 
					/* if (e) { */
						/* $("#user_img_input").click(); */
						var isChrome =  window.navigator.userAgent.indexOf("Chrome") !== -1;
						if(isChrome){
							$("#user_img_input").click();
						}else{ 
							reset();
							alertify.log("该 浏览器不支持该操作");
						}
					/* } */
				});
			})
			
		});
		function FileUpload_onselect(){
			$("#loading").show();
			$("#loading").addClass("loading");
			
			$("#user_img_form").submit(); 
			setTimeout(function(){
				var f=$("#user_img_input").val().split("\\")[$("#user_img_input").val().split("\\").length-1];
				$("#user_img").attr("src","/geek/upload/"+f);
				$("#loading").hide();
				$("#loading").removeClass("loading");
			},3000);
		}		
		
		
	</script>
	<!--  js end -->

</body>
</html>